# 类的注册器
from functools import wraps

# 定义一个装饰器类
class Decorate:
    def __init__(self, fn) -> None:
        self.fn = fn
    
    def __call__(self):
        @wraps(self.fn)
        def wrapper(*args, **kwargs):
            print("函数调用前...........")
            self.fn(*args, **kwargs)
            print("函数调用后...........")
        return wrapper


# 使用装饰器类对函数装饰  函数就变成类
@Decorate
def foo(params1, params2):
    print(f"foo function. \n"
          f"my parameters are :\n"
          f"params1: {params1} | params2: {params2}."
    )

# 函数就变成了类
obj = foo()
obj("a", "b")
